<%@ page language="java" contentType="text/html; charset=UTF-8"
 pageEncoding="UTF-8" isELIgnored="false"%>

 <head>
  <script src="/js/jquery-3.5.1.min.js"></script>
 </head>

<div style="margin:0px auto; width:500px">
 
<form action="addPost" method="post">
 
标题: <input id="title" name="title" value="${c.title}"> <br> <br>

正文：<br><textarea id="content" name="content" style="width:220px;height:400px">${c.content}</textarea> <br> <br>

<button id="submitBtn" type="submit">创建</button>
<button onclick="javascript:history.go(-1);">返回</button>
</form>
</div>

<script>
    $(document).ready(function(){
        $("#submitBtn").click(function(){
             var msg = "";
             var tv = $("#title").val();

             if(tv == ""){
                msg += "标题不能为空！" +"\n";
             }

             var cv = $("#content").val();

             if(cv == ""){
                 msg += "内容不能为空！" + "\n";
             }

             if(msg != ""){
                alert(msg);
                return false;
             }

        });

    });
</script>